package com.biz.primus.ms.evaluation.dao.po;

import com.biz.primus.ms.base.jpa.po.BaseEntity;
import lombok.Data;
import org.hibernate.envers.NotAudited;

import javax.persistence.*;
import java.util.List;

/**
 * 订单评价 {物流评价、商品评价}
 *
 * @author Tiger Feng
 * @date 2017年11月06日
 */
@Data
@Entity
@Table(name = "ord_envluation_order", indexes = {
        @Index(name = "idx_ord_envluation_order_order_code", columnList = "orderCode")
})
public class OrderEvaluation extends BaseEntity {
    /**
     * 订单编号
     */
    @Column(length = 64, unique = true)
    private String orderCode;
    /**
     * 物流评价
     */
    @OneToOne
    private DeliveryEvaluation deliveryEvaluation;
    /**
     * 商品评价
     */
    @NotAudited
    @OneToMany(mappedBy = "orderEvaluation", orphanRemoval = true, cascade = CascadeType.ALL)
    private List<ProductEvaluation> productEvaluations;

}
